package cn.the.angry.anim;

import java.awt.Image;
import java.util.Map;
import java.util.TreeMap;

public abstract class AbstractObject
{
	protected boolean isRunning;
    protected Image[] frames;
    protected Map<Object, Object> data;
    
    public AbstractObject()
    {
    }
    
    public AbstractObject(Image[] frames)
	{
        this.frames = frames;
	}
    
    public abstract Image getImage();
    
    public int getFrameWidth(){
        return getImage().getWidth(null);
	}
	
	public int getFrameHeight(){
	        return getImage().getHeight(null);
	}
	
	public void setState(boolean bool){
        isRunning = bool;
	}
	
	public int getFramesCount()
	{
		return frames.length;
	}
	
	public void setData(final Object key, final Object value)
	{
		if(data==null) data=new TreeMap<Object, Object>();
		data.put(key, value);
	}
	
	public Object getData(final Object key)
	{
		if(data==null) return null;
		else return data.get(key);
	}
}
